<?php
/*echo $_REQUEST['pro_id'];
echo $_REQUEST['project_name'];
echo $_REQUEST['project_manager'];
echo $_REQUEST['pro_description'];
echo $_REQUEST['start_date'];
echo $_REQUEST['complete_date'];
echo $_REQUEST['pro_status'];*/
include "../../operations/connection.php";
	function microtime_float()
	{
	    $a= (string)(microtime(true)*1000);
		$b=split('\.',$a);
		return $b[0];
	}
	
try {
	session_start();
	if (isset($_SESSION['addTester']) && isset($_SESSION['addCoder'])) {
		$projectid = $_REQUEST['projectid'];
		
		$testers = $_SESSION['addTester'];
		$coders = $_SESSION['addCoder'];
			
		foreach ($testers as $tester) {
			mysql_query("insert into pr_composition(IDComposition,IDProject,IDEmployee,Position, status) VALUES ('".microtime_float()."','".$projectid."','".$tester[1]."',0,0)");	
		}
		
		foreach ($coders as $coder) {
			mysql_query("insert into pr_composition(IDComposition,IDProject,IDEmployee,Position, status) VALUES ('".microtime_float()."','".$projectid."','".$coder[1]."',1,0)");	
		}
		
		unset($_SESSION['addTester']);
		unset($_SESSION['addCoder']);
	}
	
} catch (Exception $e) {
	mysql_close($connection);
}

mysql_close($connection);
?>